home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 015a / pwr14k.zip / MOVE2.PWR < prev    next >
Text File  |  1991-05-08  |  3KB  |  48 lines

  1. Variable        CLP%1,79,"a"                    ;command line parm %1
  2. Variable        CLP%2,79,"a"                    ;%2
  3. Variable        InChar,1                        ;for keyboard responses
  4. Compare         CLP%1,"a",,,Syntax              ;show syntax
  5. Compare         CLP%2,"a",,,Syntax
  6. Clear                                           ;clear the screen
  7. Upper           CLP%1                           ;make CLP%1 upper case
  8. Upper           CLP%2                           ;make CLP%2 upper case
  9. Write           "Move "                         ;build initial msg
  10. Write           CLP%1
  11. Write           " to "
  12. WriteLine       CLP%2
  13. Label           ChkFile1
  14. ?FileExist      CLP%1,File1OK                   ;does source file exist
  15. Blink                                           ;if not make screen text blink
  16. Write           CLP%1                           ;write error msg
  17. WriteLine       " not found."
  18. Normal                                          ;set text to normal
  19. Write           "Enter source file name : "     ;prompt user for new name
  20. ReadStr         CLP%1
  21. GoTo            ChkFile1
  22. Label           File1OK                         ;check new name for exists
  23. ?FileExist      CLP%2,,File2OK                  ;does destination file exist
  24. Blink                                           ;if not then text to blink
  25. Write           CLP%2                           ;write error message
  26. WriteLine       " exists!"
  27. Normal                                          ;set text to normal
  28. ReadYN          "Overwrite? [Y/N] ",InChar      ;query user
  29. WriteLine       ""
  30. Compare         InChar,"N",,,BadCopy            ;if user entered "Y" then exit
  31. Label           File2OK                         ;come here if all OK
  32. Compare         CLP%1,CLP%2,,,DupFiles          ;cannot copy to itself
  33. Copy            CLP%1 CLP%2                     ;DOS copy command
  34. ?FileExist      CLP%2,,BadCopy                  ;is output file OK
  35. Reverse                                         ;make text reverse video
  36. Write           "Erasing "                      ;write erase message
  37. WriteLine       CLP%1
  38. Normal                                          ;set text back to normal
  39. Erase           CLP%1                           ;DOS erase command
  40. WriteLine       "Move successful"               ;tell user all is OK
  41. Halt
  42. Label           DupFiles
  43. WriteLine       "Cannot move a file to itself"
  44. Label           BadCopy
  45. WriteLine       "Move unsuccessful"
  46. Label           Syntax
  47. WriteLine       "Syntax is Move2 SourceFileName TargetFileName"
  48.